#更新yum
yum upgrade -y
#关闭防火墙
systemctl stop firewalld 
systemctl disable firewalld
#关闭selinux
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
#关闭swap
swapoff -a  
sysctl -w vm.swappiness=0
sed -i 's/^UUID/#UUID/' /etc/fstab
#网桥
cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
#安装docker 
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io -y
systemctl enable docker 
systemctl start docker

yum install socat -y

echo -e "\nexport ETCD_HOME=/opt/etcd\nexport PATH=\${ETCD_HOME}/bin:\$PATH" >> /etc/profile
echo -e "\nexport KUBERNETES_HOME=/opt/kubernetes\nexport PATH=\${KUBERNETES_HOME}/bin:\$PATH" >> /etc/profile
source /etc/profile
echo "环境变量设置完成。。。。。"

echo -e "\033[42;37m ==环境初始化完成，如果要是用ha模式，请参考 ha.sh===============================================================================\033[0m"
